#!/usr/bin/env python

import wx
import sys
import component

class Contacts(component.ListCtrl):
    '''Contacts class
    
    @author Julot <andy.julot@gmail.com>
    @since Wednesday, February 29, 2012. 09:09 AM'''
    
    def __init__(self, parent, label):
        style = wx.LC_REPORT | wx.LC_SINGLE_SEL
        component.ListCtrl.__init__(self, parent, style=style)
        self.InsertColumn(1, label)
        self.SetColumnWidth(0, wx.LIST_AUTOSIZE)
    
    @property
    def models(self):
        return None
    
    @models.setter
    def models(self, models):
        self.DeleteAllItems()
        for model in models:
            index = self.InsertStringItem(sys.maxint, model.name)
            self.SetItemData(index, model.id)
